cmake_minimum_required(VERSION 2.8)
project(ffmpeg-test)

#set(CMAKE_C_COMPILER  gcc-5)
#set(CMAKE_CXX_COMPILER  g++-5)
set(CMAKE_BUILD_TYPE Release ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
#set(CMAKE_CXX_VISIBILITY_PRESET     hidden)
#set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)

set(SRC_DIR ./src)
set(SOURCES
    ${SRC_DIR}/FmtCvt.cpp
    ${SRC_DIR}/AudioDecode.cpp
    ${SRC_DIR}/AudioDecodeRaw.cpp
    ${SRC_DIR}/sg_audio_dec.cpp
    ${SRC_DIR}/sg_ffmpeg_dec.cpp
)

include_directories(
    ${SRC_DIR}
    /usr/local/ffmpeg/include/
)

#FIND_LIBRARY(LIB_GSLCBLAS       libgslcblas.a               ${SOGOU_SDK_DIR}/lib_alg  NO_DEFAULT_PATH)
#if((NOT ${LIB_GSLCBLAS} MATCHES "LIB_GSLCBLAS-NOTFOUND"))
    #set(LIBS ${LIBS} ${LIB_GSLCBLAS})
#else()
    #message(STATUS "LIB_GSLCBLAS not found ")
#endif()
#message(STATUS "LIBS : ${LIBS} ")

#FIND_LIBRARY(LIB_TTSOFF     libttsoff.so            ${SOGOU_SDK_DIR}/lib  NO_DEFAULT_PATH)

#link_libraries(
    #logger
    #${LIBS}
#)

link_directories(
    /usr/local/ffmpeg/lib
)

#add_definitions(-D__PLATFORM_SOGOU__)
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g --std=c99 -pedantic -Wall -Wextra -Wno-unused-parameter")
#add_compile_options( -fPIC -fvisibility=hidden)
add_compile_options(
    -Wall 
    -Wno-sign-compare 
    -Wno-comment 
    -Wno-unused-parameter 
    -Wno-unused-function
    -Wno-deprecated-declarations
    -Wno-attributes)
if(CMAKE_COMPILER_IS_GNUCXX)
    #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-reorder")
    set(CMAKE_CXX_FLAGS " -std=c++11 -Wno-reorder")
    message(STATUS "optional:-std=c++11")
endif(CMAKE_COMPILER_IS_GNUCXX)

# compile for front unit test
add_library(sgdec SHARED ${SOURCES} )
target_link_libraries(sgdec )

add_executable(dec_mp3 main.cpp)
target_link_libraries(dec_mp3 m rt pthread
    sgdec
    avcodec
    avformat
    avfilter
    avutil
    swresample
    )

